package com.goodfox.web.generic.file.service.impl;

import java.io.File;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;

import com.goodfox.web.generic.file.service.FileDownloadService;
import com.goodfox.web.generic.provide.util.TransformUtil;


/**
 * FileDownloadService实现类
 * @author qin gt
 *
 */
@Service("fileDownloadService")
public class FileDownloadServiceImpl implements FileDownloadService {

	/** log4j日志器 */
	private Logger logger=Logger.getLogger(FileDownloadServiceImpl.class);
		
	/**
	 * 获取路径二进制数组
	 * @param webRealPath 项目真实路径
	 * @param filePath 文件路径
	 * @return
	 */
	public byte[] getPathBytes(String webRealPath,String filePath){		
		//拼接文件路径
		String realPath = webRealPath + filePath;
		logger.info("realPath:"+realPath);
		File file = new File(realPath); 
		return TransformUtil.file2Bytes(file);
		
	}
}
